package com.hjc.answer.controller;

import com.google.gson.Gson;
import com.hjc.answer.model.CourseProj;
import com.hjc.answer.service.impl.CourseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: HJC
 * Date: 2019/11/14
 * Time: 22:41
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping("/course")
public class CourseCtl {
    //test
    @Autowired
    private CourseServiceImpl courseService;

    @RequestMapping(value = "querySubj" , method = RequestMethod.POST , produces = "text/json;charset=UTF-8")
    @ResponseBody
    public String querySubj(){
        //return 科目
        Gson gson = new Gson();
        List<CourseProj> querySub = courseService.queryAllCourse();
        return gson.toJson(querySub);
    }
}
